package com.zjut.an.adplace.manager;

import java.util.List;

import javax.annotation.Resource;

import com.zjut.an.adplace.dao.AnAdplace;
import com.zjut.an.adplace.dao.AnAdplaceDAO;


public class AnAdplaceManager {

	@Resource(name = "AnAdplaceDAO")
	private AnAdplaceDAO dao;
	
	public void addData(AnAdplace obj) {	
		dao.save(obj);
	}
	
	public void updateData(AnAdplace obj) {
		dao.update(obj);
	}
	
	public void deleteData(AnAdplace obj) {
		dao.delete(obj);
	}

	public void deleteDatas(List<AnAdplace> objllegeList) {
		for (AnAdplace AnAdplace : objllegeList) {
			dao.delete(AnAdplace);
		}
	}
	
	public List getDatas() {
		return dao.findAll();
	}

	public AnAdplace getData(int objId) {
		return dao.findById(objId);
	}

	public AnAdplace getDataByApNo(int apNo) {
		List list = dao.findByApNo(apNo);
		if (list.size()>0) {
			return (AnAdplace)dao.findByApNo(apNo).get(0);
		} else {
			return null;
		}		
	}
}
